package cate.game.train.equip.msg;

import cate.common.annotation.OperationSetter;
import cate.common.table.d.GDOperation;
import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBTrain;
import easy.java.dev.note.NoteField;

@ClientMsg(title = "装备超越的请求")
@OperationSetter(GDOperation.EQUIP_OVERSTEP)
public class EquipOverstepReq implements MsgInput {
    @NoteField("装备uid")
    public String equipUid;

    @NoteField(value = "英雄ID", detail = "如果是英雄身上的装备还会有英雄id")
    public String heroUid;

    @NoteField(value = "部位ID", detail = "如果是英雄身上的装备还会有部位id")
    public byte pos;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        GameResult<Void> r = game.train.equip.overstep(cc.getRole(), equipUid, heroUid, pos);
        if (!r.ok()) {
            game.notice.message(cc.getRole(), r);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBTrain.EQUIP_OVERSTEP_REQ;
    }
}
